package com.xianrenit.xianrenpuzi.manager.bean;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.RoundingMode;
import java.util.Date;

@Data
@Accessors(chain = true) //生成链式调用的set方法
@HeadFontStyle(fontName="华文彩云",color= 5) //头字体：
//头样式：borderLeft边框线样式   leftBorderColor:左边框线颜色   fillBackgroundColor:背景颜色 必须结合fillPatternType才能生效
@HeadStyle(borderLeft = BorderStyleEnum.DASHED,leftBorderColor = 14,
        fillBackgroundColor = 40 , fillPatternType = FillPatternTypeEnum.SQUARES)  //头样式
@HeadRowHeight(value = 50) //头行高
public class Teacher {
    //value：自定义表头名称  index：表示excel列索引，从0开始，-1表示从前到后插入
    @ExcelProperty(value = "编号" , index = 5)
    private Long id;
    @ExcelProperty(value = "姓名" , index = -1)
    @ContentFontStyle(fontName = "华文琥珀")
    private String name;
    @ExcelProperty(value = "薪水" , index = 4)
    // value：表示数字格式化的保留位数，小数点后每个#表示一位 ， roundingMode:四舍五入的方式
    @NumberFormat(value = "#.##" , roundingMode = RoundingMode.HALF_UP)
    private Double salary;
    @ExcelProperty(value = "入职时间" , index = 3)
    //时间日期格式配置
    @DateTimeFormat(value = "yyyy年MM月dd日HH时")
    private Date joinDate;
    @ExcelIgnore //忽略属性 不会写入到excel中
    private int age;
}
